#ifndef DOCKWIDGETFILELIST_H
#define DOCKWIDGETFILELIST_H

#include <QDockWidget>

#include "pfilelist.h"
#include "projectslistmodel.h"
#include "pfilelisttablemodel.h"

namespace Ui {
class DockWidgetFileList;
}

class DockWidgetFileList : public QDockWidget
{
    Q_OBJECT

public:
    explicit DockWidgetFileList(QWidget *parent = 0);
    explicit DockWidgetFileList(PFileList *fileList,QWidget *parent = 0);
    ~DockWidgetFileList();
    
    void updateWEDChange(void);
    void clearSelection(void);

    enum dlgSTATE{
        COLUMNS_SHOW,
        COLUMNS_HIDE,
        LIST_EMPTY,
        LIST_OK,
        MAYBE_CURRENT,
        CANNOTBE_CURRENT,
        MAYBE_RENAME,
        CANNOTBE_RENAME,
        MAYBE_REMOVE,
        CANNOTBE_REMOVE,
        MAYBE_OPENDLG,
        CANNOTBE_OPENDLG
                };

signals:
    void fileListChanged( void );

private slots:
    void on_toolButton_add_clicked();

    void on_toolButton_remove_clicked();

    void on_toolButton_rename_clicked();

    void on_tableView_projectsModules_clicked(const QModelIndex &index);

    void on_tableView_projectsModules_doubleClicked(const QModelIndex &index);

    void row_clicked_sl(int logicalIndex);

    void on_toolButton_hide_clicked();

    void on_toolButton_show_clicked();

    void on_toolButton_current_clicked();

    void on_toolButton_openModule_clicked();

    // void on_DockWidgetFileList_fileListChanged();

private:
    Ui::DockWidgetFileList *ui;
    QHeaderView *m_vHeader;

    PFileList *m_fileList;

    // ProjectsListModel* m_projectListModel;
    PFileListTableModel* m_filelist_model;
    bool m_isSelectedRow;
    bool m_hideColumns;
     int m_rowSelected;
    void m_installListOfModules();
    bool m_isSelectedItem; // INATTIVO PER ORA

    // Update del dialogo
    QWidget *m_parent;
    void m_update();
    void m_setupConnections();
    void m_changeState (dlgSTATE s) const;
};

#endif // DOCKWIDGETFILELIST_H
